package org.platform.tool.util;

import org.joda.time.DateTime;

public class JodaTimeUtils {
    /**
     * 获取joda时间Mills
     * 
     * @return
     */
    public static long getCurrTimeMills() {
	DateTime dt = new DateTime();
	return dt.getMillis();
    }

    /**
     * 时间格式转换yyyyMMdd
     * 
     * @return
     */
    public static String getTimeDescForTestId() {
	DateTime dt = new DateTime();
	return dt.toString("yyyyMMdd");
    }

    /**
     * 时间格式转换yyyyMMddHHmmssSSS
     * 
     * @return
     */
    public static String getTimeDescForDiagnoseId() {
	DateTime dt = new DateTime();
	return dt.toString("yyyyMMddHHmmssSSS");
	// DateTime dt = new DateTime();
	// return dt.toString("yyyyMMddHHmmss");
    }

    /**
     * 获取时间的显示
     * 
     * @param ticks
     * @return
     */
    public static String getTimeStrDesc(long ticks) {
	DateTime dt = new DateTime();
	return dt.toString("yyyy-MM-dd HH:mm:ss");
    }

    /**
     * @param timeDesc
     * @return
     */
    public static long getTime(String timeDesc) {
	DateTime dt = DateTime.parse(timeDesc);
	return dt.getMillis();
    }
}
